<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div id="scrollBody" style="position:absolute;top:0;bottom:0;left:0;right:0;overflow:scroll;height:300px;background:red;">
    <div style="font-size:20px;height:100px;background:green;">
    </div>
    <div style="font-size:20px;height:100px;background:yellow;">
    </div>
    <div style="font-size:20px;height:100px;background:blue;">
    </div>
    <div style="font-size:20px;height:100px;background:pink;">
    </div>
    <div style="font-size:20px;height:100px;background:black;">
    </div>
  </div>
  <div style="position:relative;top:350px;">
    <button onClick="scrollToTop()">按钮1</button>
    <button>按钮2</button>
  </div>
  <script>
      function scrollToTop(){
        //   这里边可以写一些逻辑，比如偶数行一个一个的置顶，不如状态等于0的一个一个的置顶！
          document.getElementById('scrollBody').scrollTop = 12;
      }
  </script>
</body>

</html>
